package main

import (
	"fmt"
	"time"
)

func main() {
	var ch chan struct{} = make(chan struct{}, 10) // 限定一次能执行的goroutine数目

	for i := 0; i < 100; i++ {
		go Gotest(i, ch)
	}

	for {
		time.Sleep(60 * time.Second)
	}
}

func Gotest(i int, ch chan struct{}) {
	ch <- struct{}{}
	fmt.Println(i, ">>>>>>>>>>>>>>", i*2)
	time.Sleep(1 * time.Second)
	<-ch
}
